-- card: 3853 from stack: in.1 -- bmap block id: 0 -- flags: 0000 -- background id: 2619 -- name: ----- HyperTalk script ----- -- part 2 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=43 top=26 right=62 bottom=77 -- title width / last selected line: 0 -- icon id / first selected line: 32462 / 32462 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: New Button ----- HyperTalk script ----- on mouseUp play "Boing" tempo 120 a push card visual zoom open go to card id 16769 of stack "Help" end mouseUp -- part contents for background part 6 ----- text ----- Message Handlers -- part contents for background part 10 ----- text ----- A script may have one or more Message Handlers. Inside the Message Handler are the instructions for HyperCard to perform if that message is sent. "MouseUp" is a message that is sent when the mouse button is let up. "MouseDown" is a message that is sent when the mouse is pressed down. If you click on a button, the message "mouseDown" is sent to that button. If you let the mouse up while still on the button, the message "mouseUp" is sent to that button. If you drag off the button before letting the mouse up, the "mouseUp" message will NOT be sent to the button. This allows you the opportunity to change your mind, and is why most button scripts use only "mouseUp" handlers. Try clicking the Test Button, waiting a second, then letting the mouse button up. Then try clicking the Test Button, dragging off of it while still holding the mouse button down, then let it up. A message handler always begins with the word "on" and is followed by the name of the message. After the instructions for the handler, you must close the handler with the word "end" followed by the name of the handler. There are many messages that you can make handlers for. The computer sends these messages whenever you do something like go to a card, leave a card, start typing in a field, etc. The computer sends some messages only to buttons, some only to fields, and some only to cards. These messages give you a lot of power to program HyperCard. For simplicity in this tutorial, we will only be concerned with messages that are sent to buttons. Are you ready to make your own handler? You will mostly use the two handlers shown in the Script Window when programming your buttons. But if you want to try an interesting one, there is a message the computer sends if the mouse merely enters the area of the button, without even clicking. It's called "mouseEnter". Try making your own handler to play "boing" if the mouse is moved over the Test Button. Then test it by clicking "Send To Button" and moving the mouse over the Test Button. Click ? to find out more about "Message Handlers". -- part contents for background part 9 ----- text ----- on mouseDown play "harpsichord" end mouseDown on mouseUp play "boing" end mouseUp -- part contents for background part 13 ----- text ----- on mouseDown play "harpsichord" end mouseDown on mouseUp play "boing" end mouseUp